﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Microsoft.Practices.Unity;
using XAPI.Data;
using XAPI.Domain;

namespace TinCan.LRS.Web.Controllers
{
    public class HomeController : Controller
    {
        #region Properties
        [Dependency]
        public IRepository StorageRepository { get; set; }
        #endregion

        public ActionResult Index()
        {
            ViewBag.Statements = StorageRepository.Query<Statement>().ToList();
            return View();
        }

        [HttpPost]
        public ActionResult Index(Statement statement)
        {
            StorageRepository.Insert<Statement>(statement);
            ViewBag.Statements = StorageRepository.Query<Statement>().ToList();
            return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your app description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }
    }
}
